package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 财务应用程序 求出销售总额
 * 			我改进了以下，用户可以输入自己想要达到的目标，
 * 然后由程序计算用户需要完成的最小销售额
 * Date:2021/4/4
 * ***************************************************************
 */
public class exc5_39 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter you goal: ");
		double goal=input.nextDouble();
		double sell=0;
		double earn=5000;//别忘了基本工资5000
		while(earn<goal) {
			sell++;
			if(sell>0.01&&sell<=5000) {
				earn=5000+0.08*sell;
			}else if(sell>5000&&sell<=10000) {
				earn=5000+5000*0.08+(sell-5000)*0.10;
			}else {
				earn=5000+5000*0.08+5000*0.10+(sell-10000)*0.12;
			}
		}
		
		System.out.print("You must sell $"+sell+" at least.");
	}

}
